home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / javax / accessibility / AccessibleState.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  12.2 KB  |  328 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)AccessibleState.java    1.26 98/08/26
  3.  *
  4.  * Copyright 1997, 1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14.  
  15. package javax.accessibility;
  16.  
  17. import java.util.Vector;
  18. import java.util.Locale;
  19. import java.util.MissingResourceException;
  20. import java.util.ResourceBundle;
  21.  
  22. /**
  23.  * <P>Class AccessibleState describes a componets particular state.  The actual
  24.  * state of the component is defined as an AccessibleStateSet, which is a
  25.  * composed set of AccessibleStates.
  26.  * <p>The toDisplayString method allows you to obtain the localized string 
  27.  * for a locale independent key from a predefined ResourceBundle for the 
  28.  * keys defined in this class.
  29.  * <p>The constants in this class present a strongly typed enumeration
  30.  * of common object roles.  A public constructor for this class has been
  31.  * purposely omitted and applications should use one of the constants
  32.  * from this class.  If the constants in this class are not sufficient
  33.  * to describe the role of an object, a subclass should be generated
  34.  * from this class and it should provide constants in a similar manner.
  35.  *
  36.  * @version     1.26 08/26/98 21:13:59
  37.  * @author      Willie Walker
  38.  * @author    Peter Korn
  39.  */
  40. public class AccessibleState extends AccessibleBundle {
  41.  
  42.     // If you add or remove anything from here, make sure you 
  43.     // update AccessibleResourceBundle.java.
  44.  
  45.     /**
  46.      * Indicates a window is currently the active window.  This includes 
  47.      * windows, dialogs, frames, etc.  In addition, this state is used
  48.      * to indicate the currently active child of a component such as a
  49.      * list, table, or tree.  For example, the active child of a list
  50.      * is the child that is drawn with a rectangle around it.
  51.      * @see AccessibleRole#WINDOW
  52.      * @see AccessibleRole#FRAME
  53.      * @see AccessibleRole#DIALOG
  54.      */
  55.     public static final AccessibleState ACTIVE    
  56.             = new AccessibleState("active");
  57.  
  58.     /**
  59.      * Indicates this object is currently pressed.  This is usually
  60.      * associated with buttons and indicates the user has pressed a
  61.      * mouse button while the pointer was over the button and has
  62.      * not yet released the mouse button.
  63.      * @see AccessibleRole#PUSH_BUTTON
  64.      */
  65.     public static final AccessibleState PRESSED
  66.             = new AccessibleState("pressed");
  67.  
  68.     /**
  69.      * Indicates that the object is armed.  This is usually used on buttons
  70.      * that have been pressed but not yet released, and the mouse pointer
  71.      * is still over the button.
  72.      * @see AccessibleRole#PUSH_BUTTON
  73.      */
  74.     public static final AccessibleState ARMED
  75.             = new AccessibleState("armed");
  76.  
  77.     /**
  78.      * Indicates the current object is busy.  This is usually used on objects
  79.      * such as progress bars, sliders, or scroll bars to indicate they are 
  80.      * in a state of transition.
  81.      * @see AccessibleRole#PROGRESS_BAR
  82.      * @see AccessibleRole#SCROLL_BAR
  83.      * @see AccessibleRole#SLIDER
  84.      */
  85.     public static final AccessibleState BUSY
  86.             = new AccessibleState("busy");
  87.  
  88.     /** 
  89.      * Indicates this object is currently checked.  This is usually used on 
  90.      * objects such as toggle buttons, radio buttons, and check boxes.
  91.      * @see AccessibleRole#TOGGLE_BUTTON
  92.      * @see AccessibleRole#RADIO_BUTTON
  93.      * @see AccessibleRole#CHECK_BOX
  94.      */
  95.     public static final AccessibleState CHECKED
  96.             = new AccessibleState("checked");
  97.  
  98.     /**
  99.      * Indicates the user can change the contents of this object.  This
  100.      * is usually used primarily for objects that allow the user to 
  101.      * enter text.  Other objects, such as scroll bars and sliders, 
  102.      * are automatically editable if they are enabled.
  103.      * @see #ENABLED
  104.      */
  105.     public static final AccessibleState EDITABLE
  106.             = new AccessibleState("editable");
  107.  
  108.     /** 
  109.      * Indicates this object allows progressive disclosure of its children.
  110.      * This is usually used with hierarchical objects such as trees and
  111.      * is often paired with the EXPANDED or COLLAPSED states.
  112.      * @see #EXPANDED
  113.      * @see #COLLAPSED
  114.      * @see AccessibleRole#TREE
  115.      */
  116.     public static final AccessibleState EXPANDABLE
  117.             = new AccessibleState("expandable");
  118.  
  119.     /**
  120.      * Indicates this object is collapsed.  This is usually paired with the
  121.      * EXPANDABLE state and is used on objects that provide progressive
  122.      * disclosure such as trees.
  123.      * @see #EXPANDABLE
  124.      * @see #EXPANDED
  125.      * @see AccessibleRole#TREE
  126.      */
  127.     public static final AccessibleState COLLAPSED
  128.             = new AccessibleState("collapsed");
  129.  
  130.     /**
  131.      * Indicates this object is expanded.  This is usually paired with the
  132.      * EXPANDABLE state and is used on objects that provide progressive
  133.      * disclosure such as trees.
  134.      * @see #EXPANDABLE
  135.      * @see #COLLAPSED
  136.      * @see AccessibleRole#TREE
  137.      */
  138.     public static final AccessibleState EXPANDED
  139.             = new AccessibleState("expanded");
  140.  
  141.     /**
  142.      * Indicates this object is enabled.  The absence of this state from an
  143.      * object's state set indicates this object is not enabled.  An object
  144.      * that is not enabled cannot be manipulated by the user.  In a graphical
  145.      * display, it is usually grayed out.
  146.      */
  147.     public static final AccessibleState ENABLED
  148.             = new AccessibleState("enabled");
  149.  
  150.     /** 
  151.      * Indicates this object can accept keyboard focus, which means all 
  152.      * events resulting from typing on the keyboard will normally be 
  153.      * passed to it when it has focus.
  154.      * @see #FOCUSED
  155.      */
  156.     public static final AccessibleState FOCUSABLE
  157.             = new AccessibleState("focusable");
  158.  
  159.     /**
  160.      * Indicates this object current has the keyboard focus.
  161.      * @see #FOCUSABLE
  162.      */
  163.     public static final AccessibleState FOCUSED
  164.             = new AccessibleState("focused");
  165.  
  166.     /**
  167.      * Indicates this object is minimized and is represented only by an
  168.      * icon.  This is usually only associated with frames and internal
  169.      * frames. 
  170.      * @see AccessibleRole#FRAME
  171.      * @see AccessibleRole#INTERNAL_FRAME
  172.      */
  173.     public static final AccessibleState ICONIFIED
  174.             = new AccessibleState("iconified");
  175.  
  176.     /** 
  177.      * Indicates something must be done with this object before the
  178.      * user can interact with an object in a different window.  This
  179.      * is usually associated only with dialogs. 
  180.      * @see AccessibleRole#DIALOG
  181.      */
  182.     public static final AccessibleState MODAL
  183.             = new AccessibleState("modal");
  184.  
  185.     /** 
  186.      * Indicates this object paints every pixel within its
  187.      * rectangular region. A non-opaque component paints only some of
  188.      * its pixels, allowing the pixels underneath it to "show through".
  189.      * A component that does not fully paint its pixels therefore
  190.      * provides a degree of transparency.
  191.      * @see Accessible#getAccessibleContext
  192.      * @see AccessibleContext#getAccessibleComponent
  193.      * @see AccessibleComponent#getBounds
  194.      */
  195.     public static final AccessibleState OPAQUE
  196.             = new AccessibleState("opaque");
  197.  
  198.     /**
  199.      * Indicates the size of this object is not fixed.
  200.      * @see Accessible#getAccessibleContext
  201.      * @see AccessibleContext#getAccessibleComponent
  202.      * @see AccessibleComponent#getSize
  203.      * @see AccessibleComponent#setSize
  204.      */
  205.     public static final AccessibleState RESIZABLE
  206.             = new AccessibleState("resizable");
  207.  
  208.  
  209.     /**
  210.      * Indicates this object allows more than one of its children to
  211.      * be selected at the same time.
  212.      * @see Accessible#getAccessibleContext
  213.      * @see AccessibleContext#getAccessibleSelection
  214.      * @see AccessibleSelection
  215.      */
  216.     public static final AccessibleState MULTISELECTABLE
  217.             = new AccessibleState("multiselectable");
  218.  
  219.     /**
  220.      * Indicates this object is the child of an object that allows its
  221.      * children to be selected, and that this child is one of those
  222.      * children that can be selected.
  223.      * @see #SELECTED
  224.      * @see Accessible#getAccessibleContext
  225.      * @see AccessibleContext#getAccessibleSelection
  226.      * @see AccessibleSelection
  227.      */
  228.     public static final AccessibleState SELECTABLE
  229.             = new AccessibleState("selectable");
  230.  
  231.     /**
  232.      * Indicates this object is the child of an object that allows its
  233.      * children to be selected, and that this child is one of those
  234.      * children that has been selected.
  235.      * @see #SELECTABLE
  236.      * @see Accessible#getAccessibleContext
  237.      * @see AccessibleContext#getAccessibleSelection
  238.      * @see AccessibleSelection
  239.      */
  240.     public static final AccessibleState SELECTED
  241.             = new AccessibleState("selected");
  242.  
  243.     /**
  244.      * Indicates this object, the object's parent, the object's parent's
  245.      * parent, and so on, are all visible.  Note that this does not 
  246.      * necessarily mean the object is painted on the screen.  It might
  247.      * be occluded by some other showing object.
  248.      * @see #VISIBLE
  249.      */
  250.     public static final AccessibleState SHOWING
  251.             = new AccessibleState("showing");
  252.  
  253.     /**
  254.      * Indicates this object is visible.  Note: this means that the
  255.      * object intends to be visible; however, it may not in fact be
  256.      * showing on the screen because one of the objects that this object
  257.      * is contained by is not visible.
  258.      * @see #SHOWING
  259.      */
  260.     public static final AccessibleState VISIBLE
  261.             = new AccessibleState("visible");
  262.  
  263.     /**
  264.      * Indicates the orientation of this object is vertical.  This is
  265.      * usually associated with objects such as scrollbars, sliders, and
  266.      * progress bars.
  267.      * @see #VERTICAL
  268.      * @see AccessibleRole#SCROLL_BAR
  269.      * @see AccessibleRole#SLIDER
  270.      * @see AccessibleRole#PROGRESS_BAR
  271.      */
  272.     public static final AccessibleState VERTICAL
  273.             = new AccessibleState("vertical");
  274.  
  275.     /**
  276.      * Indicates the orientation of this object is horizontal.  This is
  277.      * usually associated with objects such as scrollbars, sliders, and
  278.      * progress bars.
  279.      * @see #HORIZONTAL
  280.      * @see AccessibleRole#SCROLL_BAR
  281.      * @see AccessibleRole#SLIDER
  282.      * @see AccessibleRole#PROGRESS_BAR
  283.      */
  284.     public static final AccessibleState HORIZONTAL
  285.             = new AccessibleState("horizontal");
  286.  
  287.     /**
  288.      * Indicates this (text) object can contain only a single line of text
  289.      */
  290.     public static final AccessibleState SINGLE_LINE
  291.             = new AccessibleState("singleline");
  292.  
  293.     /**
  294.      * Indicates this (text) object can contain multiple lines of text
  295.      */
  296.     public static final AccessibleState MULTI_LINE
  297.             = new AccessibleState("multiline");
  298.  
  299.     /**
  300.      * Indicates this object is transient.  An assistive technology should
  301.      * not add a PropertyChange listener to an object with transient state,
  302.      * as that object will never generate any events.  Transient objects
  303.      * are typically created to answer Java Accessibility method queries,
  304.      * but otherwise do not remain linked to the underlying object (for
  305.      * example, those objects underneath lists, tables, and trees in Swing,
  306.      * where only one actual UI Component does shared rendering duty for
  307.      * all of the data objects underneath the actual list/table/tree elements).
  308.      * 
  309.      */
  310.     public static final AccessibleState TRANSIENT
  311.             = new AccessibleState("transient");
  312.  
  313.     /**
  314.      * Create a new AccessibleState using the given locale independent key.
  315.      * This should not be a public method.  Instead, it is used to create
  316.      * the constants in this file to make it a strongly typed enumeration.
  317.      * Subclasses of this class should enforce similar policy.
  318.      * @param key the locale independent name of the state.
  319.      * @note The String should be a locale independent key for the state.
  320.      * It is not intended to be used as the actual String to display 
  321.      * to the user.  To get the localized string, use toDisplayString.
  322.      * @see AccessibleBundle#toDisplayString
  323.      */
  324.     protected AccessibleState(String key) {
  325.         this.key = key;        
  326.     }
  327. }
  328.